// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   check_delete_ok.java

package finance.voucher;

import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;
import validata.ValidataFinanceTag;

public class check_delete_ok extends HttpServlet
{

	public check_delete_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		javax.servlet.ServletContext dbApplication = dbSession.getServletContext();
		HttpSession session = request.getSession();
		nseer_db_backup1 finance_db = new nseer_db_backup1(dbApplication);
		ValidataFinanceTag vt = new ValidataFinanceTag();
		try
		{
			if (finance_db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				String voucher_id = request.getParameter("voucher_id");
				String register_time = request.getParameter("register_time");
				String check_time = request.getParameter("check_time");
				String checker = request.getParameter("checker");
				String checker_id = request.getParameter("checker_id");
				if (vt.validata((String)dbSession.getAttribute("unit_db_name"), "finance_voucher", "voucher_in_month_id", voucher_id, "register_time", register_time, "check_tag").equals("0"))
				{
					try
					{
						String sql2 = (new StringBuilder("update finance_voucher set check_tag='9',change_tag='0',check_time='")).append(check_time).append("',checker='").append(checker).append("',checker_id='").append(checker_id).append("' where voucher_in_month_id='").append(voucher_id).append("' and register_time='").append(register_time).append("'").toString();
						finance_db.executeUpdate(sql2);
					}
					catch (Exception ex)
					{
						ex.printStackTrace();
					}
					response.sendRedirect("finance/voucher/check_list.jsp");
				} else
				{
					response.sendRedirect("finance/voucher/check_delete_ok_a.jsp");
				}
				finance_db.commit();
				finance_db.close();
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
